<?php 
	$id        = $_POST['id'];
?>

<html>
    <head>
        <title>Versiones</title>
        <link rel='stylesheet' href='estilos.css'>
    </head>
    <body>
    <p>
		<label class="Titulo">Compare versions</label>
		</p>
        <form class='introducir' method='POST' action='compare_versions2.php'>
            <div><label class="Titulo2">What versions do you want to compare?</label> 
            <select name="version1" size=1>
			<?php
				include "conexion.php";
			
				//Busco las versiones del proyecto en el que nos encontramos
				$versiones = mysql_query("SELECT * FROM project p where p.idProject='$id'"); 
				while($proy = mysql_fetch_array($versiones)) { 
					echo "<option value='".$proy['version_number']."'>".$proy['version_number']."</option>";
				}include "cerrar_conexion.php";
				?> 
			</select>
			<select name="version2" size=1>
			<?php
				include "conexion.php";
			
				//Busco las versiones del proyecto en el que nos encontramos
				$versiones = mysql_query("SELECT * FROM project p where p.idProject='$id'"); 
				if (mysql_num_rows($versiones)<2){?>
					   	 <head> 
					    	<script>
				            	window.alert("There are no versions to compare");
				                history.back();
				            </script>
					    </head> 
				    	<?php
				}while($proy = mysql_fetch_array($versiones)) { 
					echo "<option value='".$proy['version_number']."'>".$proy['version_number']."</option>";
				}include "cerrar_conexion.php";
				?> 
			</select>
			</div>
			<input type="hidden" name="id" value='<?php echo $id;?>'>
			<div><input type='submit' value='Submit' class='boton'></div>			
        </form>
    </body>
</html>
